﻿// Models/User.cs
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace WebApplication1.Models
{
    /// <summary>
    /// 用户实体类
    /// </summary>
    [Table("Users")]
    public class User
    {
        /// <summary>
        /// 用户ID
        /// </summary>
        [Key]
        public int UserId { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        [Required(ErrorMessage = "用户名不能为空")]
        [Display(Name = "用户名")]
        [StringLength(50, ErrorMessage = "用户名不能超过50个字符")]
        public string Username { get; set; }

        /// <summary>
        /// 密码
        /// </summary>
        [Required(ErrorMessage = "密码不能为空")]
        [Display(Name = "密码")]
        [DataType(DataType.Password)]
        public string Password { get; set; }

        /// <summary>
        /// 姓名
        /// </summary>
        [Required(ErrorMessage = "姓名不能为空")]
        [Display(Name = "姓名")]
        [StringLength(50, ErrorMessage = "姓名不能超过50个字符")]
        public string FullName { get; set; }

        /// <summary>
        /// 角色 (Admin:管理员, Employee:员工)
        /// </summary>
        [Required(ErrorMessage = "角色不能为空")]
        [Display(Name = "角色")]
        public string Role { get; set; }

        /// <summary>
        /// 部门
        /// </summary>
        [Display(Name = "部门")]
        [StringLength(100, ErrorMessage = "部门不能超过100个字符")]
        public string Department { get; set; }
    }
}